/**
 * 
 */
package com.nari.sink.utils.excelupload;

import com.nari.platform.model.ResponseMsg;
import com.nari.platform.utils.NumberSystemConversion;
import com.nari.sink.utils.excelupload.parseentity.ExcelSinkerDictEntity;

/**
 * 标准散热器信息校验
 * @author Xiaopeng
 * @date 2014-4-17
 */
public class SinkerDictExcelVerify {

	/**
	 * 校验Excel记录信息的完整性
	 * @param sinkerDictEntity
	 * @return
	 * @author Xiaopeng
	 * @date 2014-4-17
	 */
	public static ResponseMsg verifyExcelRecord(ExcelSinkerDictEntity sinkerDictEntity) {
		//校验标识位
		boolean verifyFlag = true;
		//校验反馈信息
		StringBuffer verifyMsg = new StringBuffer("");
		//型号
		if(sinkerDictEntity.getSinkType()==null || "".equals(sinkerDictEntity.getSinkType().trim())) {
			verifyFlag = false;
			verifyMsg.append("<型号>").append("、");
		}
		//散热器中心距
		if(NumberSystemConversion.compareFloatValue(sinkerDictEntity.getSinkCenDis(), 0) <= 0) {
			verifyFlag = false;
			verifyMsg.append("<中心距>").append("、");
		}
		//单片功率
		if(NumberSystemConversion.compareFloatValue(sinkerDictEntity.getCalPower(), 0) <= 0) {
			verifyFlag = false;
			verifyMsg.append("<单片功率>").append("、");
		}
		//构造校验结果
		if(verifyFlag) {
			return ResponseMsg.getInstance(true, "");
		} 
		String rmsg = "请检查Excel中行号为【"+sinkerDictEntity.getRowCounter()+"】的以下列是否填写完整：";
		rmsg += verifyMsg.substring(0, verifyMsg.length()-1);
		return ResponseMsg.getInstance(false, rmsg);
	}
}
